/*!
 * jQuery JavaScript Library v1.6.4
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Mon Sep 12 18:54:48 2011 -0400
 */
$(function(){
	//$("#add_group_panel").hide();
	$("#list_group").hide();
	$("#list_a").click(function(){
		$("#add_group_panel").hide();
		$("#list_group").show();
		return false;
	});
	
	$("#add_a").click(function(){
		$("#list_group").hide();
		$("#add_group_panel").show();
	});
	
	$(".group_del_bt").click(function(){
		group_del(this);
	});
	
});
function group_del(btn){
	
	var curBtn=$(btn);
	var selectedGroupId=$(".Id_cl",$(btn).parent().parent()).text();
	/*alert(transDataId);*/
	$.post("/RobotWeb/admin/DeleteGroupAction.action",{groupInfoId:selectedGroupId}
	,function(data){
		$(curBtn).parents(".for_del").remove();
	});
}

$(function(){
	$("#adduser_div select").hide();
	$("#select_user_panel").hide();
	$("#adduser_div a").click(function(){
		$("#adduser_div select").show();
		$("#select_user_panel").show(1000);
		return false;
	});
	
	$("#select_user_panel li").dblclick(function(){
		var selectUserId=$("p",$(this)).text();
		//alert(selectUserId);
		//alert($(selectUserId).text());
		if($(selectUserId)==null){
			alert("already...");
			return;
		}
		var name=$("font",$(this)).text();
		if ($("#selectedFunctions").html().indexOf("id=\""+selectUserId+"\"") < 0) {
			$("#selectedFunctions").append("<option id=\""+selectUserId+"\" value=\""+selectUserId+"\">"+name+"</option>");
		}
	});
});

$(function(){
	$(":submit[id=group_submit]").click(function(){
		$("#selectedFunctions").children().each(function(){$(this).attr("selected","selected")});
	});
	
});
